<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .a {
        color: red;
      }
      .b {
        font-size: 3rem;
      }
      .c {
        border: solid;
      }
    </style>
  </head>
  <body>
    <div class="a b c">hello jack</div>
    <div id="box">hello jack</div>
    <script>
      const box = document.getElementById("box");
      //添加样式类
      box.classList.add("a", "b", "c");
      setTimeout(() => {
        // 删除样式类
        box.classList.remove("a", "b");
        // 判断样式类是否存在
        console.log(box.classList.contains("a"));
        console.log(box.classList.contains("c"));
      }, 3000);
    </script>
  </body>
</html>
